package com.yuandian.api.customer_perception.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 类说明: 系统告警总览
 *
 * @Date 2021/8/16 15:06
 * @Author User
 */
@Getter
@Setter
@ToString
@HeadRowHeight(30)
public class AlarmOverviewVo {
    /**
     * 序号
     */
    private Integer id;

    /**
     * 系统ID
     */
    @ExcelIgnore
    private Integer systemId;

    /**
     * 系统名称
     */
    private String systemName;

    /**
     * 业务编码
     */
    @ExcelIgnore
    private String businessCode;

    /**
     * 业务名称
     */
    private String businessName;

    /**
     * 访问量
     */
    private Integer visitCount;

    /**
     * 受理量
     */
    private Integer completeCount;


    /**
     * 告警量
     */
    private Integer alarmCount;

    /**
     * HTTP 返回码
     */
    private Integer httpStatusCount;

    /**
     * 业务提示语
     */
    private Integer businessTipCount;

    /**
     * 业务返回码
     */
    private Integer businessStatusCount;

    /**
     * 成功率
     */
    private String successRate;

    @JsonIgnore
    @ExcelIgnore
    private Double successRateTmp;

    /**
     * 健康度
     */
    private String healthRate;

    @JsonIgnore
    @ExcelIgnore
    private Double healthRateTmp;


    public void handleNumberFormat () {
        if (null != successRateTmp && successRateTmp.equals(100d)) {
            successRate = String.format("%.0f", successRateTmp);
        } else {
            successRate = String.format("%.2f", successRateTmp == null ? 0 : successRateTmp);
        }


        if (null != healthRateTmp && healthRateTmp.equals(100d)) {
            healthRate = String.format("%.0f", healthRateTmp);
        } else {
            healthRate = String.format("%.2f", healthRateTmp == null ? 0 : healthRateTmp);
        }
    }
}
